package com.tadpole.music.holder.study;

import android.annotation.SuppressLint;
import android.view.View;
import android.widget.TextView;

import com.tadpole.music.R;
import com.tadpole.music.adapter.base.BaseAdapter;
import com.tadpole.music.bean.study.ErrorQuestionFootBean;
import com.tadpole.music.bean.study.MoNiQuestionErrorBean;
import com.tadpole.music.holder.base.BaseViewHolder;
import com.tadpole.music.utils.NoDoubleClickListener;

import java.util.List;

/**
 * Created By 孙岩
 * on 2020/9/10
 */
public class ErrorTopicViewHolder extends BaseViewHolder {
    private View itemView;
    private List<MoNiQuestionErrorBean.DataBeanX.DataBean> list;
    //名称
    private TextView tvErrorName;
    //数量
    private TextView tvErrorCount;
    private BaseAdapter.OnItemClickListener onItemClickListener;
    public ErrorTopicViewHolder(View itemView, List<MoNiQuestionErrorBean.DataBeanX.DataBean> list, BaseAdapter.OnItemClickListener onItemClickListener) {
        super(itemView);
        this.itemView = itemView;
        this.list = list;
        this.onItemClickListener = onItemClickListener;
    }

    @SuppressLint("SetTextI18n")
    @Override
    public void init(final int position) {
        tvErrorName = itemView.findViewById(R.id.tvErrorName);
        tvErrorCount = itemView.findViewById(R.id.tvErrorCount);

        tvErrorName.setText(list.get(position).getClassX());

        tvErrorCount.setText(list.get(position).getNum()+"");

        itemView.setOnClickListener(new NoDoubleClickListener() {
            @Override
            protected void onNoDoubleClick(View v) {
                onItemClickListener.onItemClick(itemView,position);
            }
        });
    }
}
